package com.boot.security.server.dao.product;

import java.util.List;
import java.util.Map;

import org.apache.ibatis.annotations.Delete;
import org.apache.ibatis.annotations.Insert;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Options;
import org.apache.ibatis.annotations.Param;
import org.apache.ibatis.annotations.Select;

import com.boot.security.server.model.product.TswMediaLibrary;

@Mapper
public interface TswMediaLibraryDao {

    @Select("select * from tsw_media_library t where t.id = #{id}")
    TswMediaLibrary getById(Long id);

    @Delete("delete from tsw_media_library where id = #{id}")
    int delete(Long id);

    int update(TswMediaLibrary tswMediaLibrary);
    
    @Options(useGeneratedKeys = true, keyProperty = "id")
    @Insert("insert into tsw_media_library(media_name, media_path, media_type, updater, update_time, state, media_note, media_remark, file_size, media_classification, media_time, creater) values(#{mediaName}, #{mediaPath}, #{mediaType}, #{updater}, #{updateTime}, #{state}, #{mediaNote}, #{mediaRemark}, #{fileSize}, #{mediaClassification}, #{mediaTime}, #{creater})")
    int save(TswMediaLibrary tswMediaLibrary);
    
    int count(@Param("params") Map<String, Object> params);

    List<TswMediaLibrary> list(@Param("params") Map<String, Object> params, @Param("offset") Integer offset, @Param("limit") Integer limit);
}
